package cn.edu.zafu.bigdata.x.zhaobolei.Fifth;

class chu{
    public static int divide(int a,int b){
        if(b==0){
            throw new ArithmeticException("除数不能为 0");
        }
        return a/b;
    }
}

public class Division {
    public static void main(String[] args) {
        try {
            int result1 = chu.divide(10, 5);
            System.out.println("Result：" + result1);

            int result2 = chu.divide(10, 0);
            System.out.println("Result：" + result2);

            int result3 = chu.divide(10, 2);
            System.out.println("Result：" + result3);
        } catch (ArithmeticException e) {
            System.out.println("Error：" + e.getMessage());
        }
    }
}